
#########################################################################
#                                                                       #
# Makefile for Cannon's Matrix Multiplication 				#
#  The defaults are set up in an arch.* file				#
#                                                                       #
#  Requires a fast SGEMM routine, e.g. Intel MKL			#
#                                                                       #
#########################################################################


HOST = $(shell hostname)
TRESTLES   =  $(shell expr match `hostname` trestles)
LILLIPUT   =  $(shell expr match `hostname` lilliput)
TRITON   =  $(shell expr match `hostname` lilliput)
FORGE   =  $(shell expr match `hostname` forge)
CSECLASS   =  $(shell expr match `hostname` cseclass)


ifneq ($(LILLIPUT), 0)
PUB	= /class/public/cse260-wi12
else
ifneq ($(CSECLASS), 0)
PUB	= /class/public/cse260-wi12
else
ifneq ($(TRESTLES), 0)
PUB     = /home/baden/cse260-wi12
else
ifneq ($(TRITON), 0)
PUB     = /home/sbaden/cse260-fa10
else
ifneq ($(FORGE), 0)
PUB = /home/baden/cse260-wi12
else
PUB = /Users/scottbaden/lib
endif
endif
endif
endif
endif

# If you don't need PPF, use this include
# include $(PUB)/Arch/arch.intel-mkl.mpi

# If you want to use need PPF, use this include
include $(PUB)/Arch/arch.intel-mkl.mpi.ppf


# Add symbol table information for gdb
ifeq ($(debug), 1)
        CFLAGS += -g
        LDFLAGS += -g
        C++FLAGS += -g
endif   



LDLIBS += $(LIB_BLAS) -lm


app:		cannon


OBJ	=  cannon.o getHost.o cmdLine.o utils.o

cannon:	$(OBJ)
	$(C++LINK) $(LDFLAGS) -o $@ $(OBJ)  $(LDLIBS)

S_OBJ	=  summa.o getHost.o cmdLine.o utils.o

summa:	$(S_OBJ)
	$(C++LINK) $(LDFLAGS) -o $@ $(S_OBJ)  $(LDLIBS)

clean:	
	$(RM) *.o cannon;
	$(RM) core;

